﻿using Grow.GuidGenerator.CreateGuidGenerator;
using Grow.GuidGenerator.Sequential.CreateGuidGenerator;
using Grow.Module;
using Grow.Module.Service;
using Microsoft.Extensions.DependencyInjection;

namespace Grow.GuidGenerator.Sequential
{
    public abstract class GuidGeneratorSequentialModuleBase : ModuleBase, IGuidGeneratorModule
    {
        public override ModuleLevel Level => ModuleLevel.Framework;
        public override void AddDependModule(IDependModuleBuilder dependModuleBuilder)
        {
        }


        public override void AddService(IServiceContainer serviceContainer)
        {
            CreateGuidGeneratorBuilder createGuidGeneratorBuilder = new(serviceContainer);
            CreateGuidGenerator(createGuidGeneratorBuilder);
            serviceContainer.BuilderManager.SetBuilder<ICreateGuidGeneratorBuilder>(createGuidGeneratorBuilder);

            _ = serviceContainer.ServiceCollection.AddTransient<IGuidGenerator, GuidGenerator>();
        }

        public abstract void CreateGuidGenerator(ICreateGuidGeneratorBuilder createGuidGeneratorBuilder);

        public override void UseService(IServiceContext serviceContext)
        {
        }

    }
}
